package com.yohann.designPattern.prototype.deepClone;

/**
 * <p>
 * 客户端
 * </p>
 *
 * @author Yohann
 * @since 2021/2/2 15:56
 */
public class Client {
    public static void main(String[] args) throws CloneNotSupportedException {
//        DeepPrototype deepPrototype = new DeepPrototype();
//        deepPrototype.name = "clone-test";
//        deepPrototype.target = new DeepCloneableTarget("clone-name", "clone-class");
//
//        DeepPrototype clone1 = deepPrototype.clone();
//        DeepPrototype clone2 = deepPrototype.clone();
//
//        //false
//        System.out.println(clone1 == clone2);
//        //false
//        System.out.println(clone1.target == clone2.target);

        DeepPrototype deepPrototype = new DeepPrototype();
        deepPrototype.name = "clone-test";
        deepPrototype.target = new DeepCloneableTarget("clone-name", "clone-class");

        DeepPrototype clone1 = deepPrototype.deepClone();
        DeepPrototype clone2 = deepPrototype.deepClone();

        //false
        System.out.println(clone1 == clone2);
        //false
        System.out.println(clone1.target == clone2.target);
    }
}